package cn.com.cym.gamezao.entity.authorize;

import cn.com.cym.gamezao.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 用于存储用户与角色之间的关系
 */
@Setter
@Getter
@Accessors(chain = true)
@NoArgsConstructor
@Table(name = "a_role_user")
@Entity
@ApiModel(description="用户角色映射关系")
public class UserRole extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 640885080665246815L;

    @ManyToOne
    @JoinColumn(name = "role_id")
    //@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Role role;


    @ManyToOne
    @JoinColumn(name = "user_id")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private User user;

}
